﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace Common
{
    public class MD5Encrypt
    {
        /// <summary>
        /// MD5加密
        /// </summary>
        /// <param name="password"></param>
        /// <returns>keyMd5加密字符串</returns>
        public static string MD5Create(string password)
        {
            MD5 mp = MD5.Create();
            byte[] _byte = mp.ComputeHash(Encoding.UTF8.GetBytes(password));
            string keyMd5 = string.Empty;
            for (int i = 0; i < _byte.Length; i++)
            {
                keyMd5 += _byte[i].ToString("x");
            }
            return keyMd5;
        }
    }
}
